<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>数据迁移</title>
    <link rel="stylesheet" href="/dist/bootstrap.css">
</head>
<body>

<div class="migration"></div>

<script src="/dist/jquery.js"></script>
<script src="/dist/axios.js"></script>
<script>

    // url = url + '?page='+page+'&table='+table
    function migration(url, table, page=1) {
        axios.get(url, {
            params: {
                page: page,
                table: table,
            }
        }).then(d => {
            req = d.data
            if (req .data) {
                if (req.page && req.table) {
                    migration(url, req.table, req.page)
                    text = '<div class="alert my-3">迁移数据表：'+table+'，本次耗时：'+req.time+'，准备迁移数据表：'+req.table+'，页码：'+req.page+'</div>'
                    $('.migration').append()
                } else {
                    text = '<div class="alert alert-danger my-3">数据表迁移停止：'+table+'，本次耗时：'+req.time+'</div>'
                }
            }
        })
    }
    url = '/{{ request()->path() }}';
    page = 1;
    table = 'warranty';
    migration(url, table, page)

</script>
</body>
</html>